package com.example.module_mine.viewmodel

import com.example.lib_common.base.BaseViewModel
import com.example.module_mine.repository.LoginRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import javax.inject.Inject

@HiltViewModel
class LoginViewModel @Inject constructor(private val repository: LoginRepository): BaseViewModel() {

    val phone: MutableStateFlow<String> = MutableStateFlow("")
    val password: MutableStateFlow<String> = MutableStateFlow("")

    //保存当前正在显示的fragment
    private val _currentFragment = MutableStateFlow("")
    val currentFragment: StateFlow<String>
        get() = _currentFragment

    fun setShowingFragmentTag(tag: String) {
        _currentFragment.value = tag
    }

    fun clearPhone() {
        phone.value = ""
    }

    fun clearPassword() {
        password.value = ""
    }
}